package com.aaa.controller.api;

import com.aaa.aop.annotation.Log;
import com.aaa.entity.CheckItem;
import com.aaa.service.CheckItemService;
import com.aaa.vo.CheckItemVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/**
 * @BelongsPackage: com.aaa.controller.api
 * @Description:
 * @CreateTime: 2023-03-30  16:13
 * @Author: ql
 */
@RestController
@RequestMapping("system/api/checkItem")
public class ApiCheckItemController {

    @Autowired
    private CheckItemService checkItemService;

    @PostMapping("/pageCheckItem")
    public Result<IPage<CheckItem>> queryPage(@RequestBody CheckItemVo checkItemVo){
        return checkItemService.queryPage(checkItemVo);
    }

    @GetMapping("/queryById/{id}")
    public Result<CheckItem> queryById(@PathVariable Long id){
        return checkItemService.queryById(id);
    }

    @PostMapping("/addOrUpdCheckItem")
    public Result<String> addOrUpdCheckItem(@RequestBody CheckItem checkItem){
        return checkItemService.addOrUpdCheckItem(checkItem);
    }

    @DeleteMapping("/deleteByIds/{id}")
    @Log(title = "批量删除",business_type = "1")
    public Result<String> deleteByIds(@PathVariable Long[] id){
        System.out.println("=========== " + Arrays.toString(id));
        return checkItemService.deleteByIds(id);
    }

}
